File manager - Edit - /home/autoph/public_html/projects/tickets-autohub/app/Http/Controllers/DepartmentController.php
Back
<?php namespace App\Http\Controllers; use App\Models\Department; use Illuminate\Http\Request; class DepartmentController extends Controller { public function importDepartment(){ $url = 'https://autohub.ph/connect/api/v1/asa/api.php'; // dd($comp_id); $parameters = array( 'key'=>"99799116300681219", ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parameters)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $op = curl_exec ($ch); $err = curl_error($ch); //if you need curl_close ($ch); $response = json_decode($op,true); foreach($response as $row){ Department::updateOrCreate([ 'id' => $row['id'], 'dept_name' => $row['dept_name'], ]); } return response()->json(['message' => "Success"]); } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings